library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggrepel)
library(cowplot)
##
## Attaching package: 'cowplot'
##
## The following object is masked from 'package:lubridate':
##
## stamp
library(gridExtra)
##
## Attaching package: 'gridExtra'
##
## The following object is masked from 'package:dplyr':
##
## combine
sem <- function(x, na.rm=FALSE) {
sd(x,na.rm=na.rm)/sqrt(length(na.omit(x)))
} #standard error function
get_legend<-function(myggplot){
tmp <- ggplot_gtable(ggplot_build(myggplot))
leg <- which(sapply(tmp$grobs, function(x) x$name) == "guide-box")
legend <- tmp$grobs[[leg]]
return(legend)
} #legend function for grid_arrange
elev_three_palette <- c("#0043F0", "#C9727F", "#F5A540") #colors from Gremer et al 2019
elev_order <- c("High", "Mid", "Low")
flint_all_year <- read_csv("../output/Climate/flint_climate_UCDpops.csv")
## Rows: 38675 Columns: 14
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): parent.pop, elevation.group, month
## dbl (11): elev_m, Lat, Long, year, aet, cwd, pck, pet, ppt, tmn, tmx
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(flint_all_year)
## # A tibble: 6 × 14
## parent.pop elevation.group elev_m Lat Long year month aet cwd pck
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <chr> <dbl> <dbl> <dbl>
## 1 BH Low 511. 37.4 -120. 1895 dec 3.23 27.9 0
## 2 BH Low 511. 37.4 -120. 1895 nov 4.89 40.8 0
## 3 BH Low 511. 37.4 -120. 1895 oct 8.9 80.8 0
## 4 BH Low 511. 37.4 -120. 1896 apr 72.5 36.2 0
## 5 BH Low 511. 37.4 -120. 1896 aug 24.5 149. 0
## 6 BH Low 511. 37.4 -120. 1896 dec 3.38 30.3 0
## # ℹ 4 more variables: pet <dbl>, ppt <dbl>, tmn <dbl>, tmx <dbl>
bioclim_all_year <- read_csv("../output/Climate/bioclim_all_year_UCD_pops.csv")
## Rows: 2944 Columns: 16
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): parent.pop, elevation.group
## dbl (14): elev_m, Lat, Long, year, ann_tmean, mean_diurnal_range, temp_seaso...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(bioclim_all_year)
## # A tibble: 6 × 16
## parent.pop elevation.group elev_m Lat Long year ann_tmean
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 BH Low 511. 37.4 -120. 1896 14.8
## 2 BH Low 511. 37.4 -120. 1897 14.4
## 3 BH Low 511. 37.4 -120. 1898 14.5
## 4 BH Low 511. 37.4 -120. 1899 14.9
## 5 BH Low 511. 37.4 -120. 1900 15.0
## 6 BH Low 511. 37.4 -120. 1901 15.3
## # ℹ 9 more variables: mean_diurnal_range <dbl>, temp_seasonality <dbl>,
## # temp_ann_range <dbl>, tmean_wettest_quarter <dbl>,
## # tmean_driest_quarter <dbl>, ann_ppt <dbl>, ppt_seasonality <dbl>,
## # ppt_warmest_quarter <dbl>, ppt_coldest_quarter <dbl>
flint_recent_all_year <- flint_all_year %>%
mutate(month = recode(month, #convert months to numbers
jan = 1,
feb = 2,
mar = 3,
apr = 4,
may = 5,
jun = 6,
jul = 7,
aug = 8,
sep = 9,
oct = 10,
nov = 11,
dec = 12
)) %>%
filter(parent.pop != "UCD_Garden", parent.pop != "WL2_Garden") %>% #remove garden sites
filter(year>1993 & year<=2023) %>%
select(parent.pop:month, cwd, pck, ppt, tmn, tmx)
flint_historical_all_year <- flint_all_year %>%
mutate(month = recode(month, #convert months to numbers
jan = 1,
feb = 2,
mar = 3,
apr = 4,
may = 5,
jun = 6,
jul = 7,
aug = 8,
sep = 9,
oct = 10,
nov = 11,
dec = 12
)) %>%
filter(parent.pop != "UCD_Garden", parent.pop != "WL2_Garden") %>% #remove garden sites
filter(year<=1993 & year>1963) %>%
select(parent.pop:month, cwd, pck, ppt, tmn, tmx)
bioclim_recent <- bioclim_all_year %>%
filter(year>1993 & year<=2023)
bioclim_historical <- bioclim_all_year %>%
filter(year<=1993 & year>1963)
flint_recent_all_year_mosavgs <- flint_recent_all_year %>% group_by(parent.pop, elevation.group, elev_m, month) %>% summarise_at(c("cwd", "pck", "ppt", "tmn", "tmx"), c(mean, sem), na.rm = TRUE)
names(flint_recent_all_year_mosavgs) <- gsub("fn2", "sem", colnames(flint_recent_all_year_mosavgs))
names(flint_recent_all_year_mosavgs) <-gsub("fn1", "mean", colnames(flint_recent_all_year_mosavgs))
flint_recent_all_year_mosavgs #30 year averages during growth season months
## # A tibble: 276 × 14
## # Groups: parent.pop, elevation.group, elev_m [23]
## parent.pop elevation.group elev_m month cwd_mean pck_mean ppt_mean tmn_mean
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 BH Low 511. 1 29.4 0 124. 2.81
## 2 BH Low 511. 2 41.0 0 93.9 3.32
## 3 BH Low 511. 3 53.9 0 90.1 4.82
## 4 BH Low 511. 4 59.0 0 48.2 6.41
## 5 BH Low 511. 5 51.4 0 23.2 9.78
## 6 BH Low 511. 6 89.3 0 6.34 13.6
## 7 BH Low 511. 7 138. 0 0.281 17.5
## 8 BH Low 511. 8 154. 0 1.00 17.1
## 9 BH Low 511. 9 130. 0 3.75 14.4
## 10 BH Low 511. 10 89.1 0 27.7 9.63
## # ℹ 266 more rows
## # ℹ 6 more variables: tmx_mean <dbl>, cwd_sem <dbl>, pck_sem <dbl>,
## # ppt_sem <dbl>, tmn_sem <dbl>, tmx_sem <dbl>
flint_recent_all_year_mosavgs$elevation.group <- factor(flint_recent_all_year_mosavgs$elevation.group, levels=elev_order)
flint_recent_all_year_mosavgs %>% ggplot(aes(x=month, y=cwd_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=cwd_mean-cwd_sem,ymax=cwd_mean+cwd_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_x_continuous(breaks=c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0")+
labs(fill="Elevation",x="Population", y="Avg CWD" ,title = "Average CWD Year-Round - Recent Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1)) +
facet_wrap(~parent.pop)
ggsave("../output/Climate/all_year_Avg_Monthly_CWD_RecentClim.png", width = 16, height = 10, units = "in")
flint_recent_all_year_mosavgs %>% ggplot(aes(x=month, y=pck_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=pck_mean-pck_sem,ymax=pck_mean+pck_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_x_continuous(breaks=c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0")+
labs(fill="Elevation",x="Population", y="Avg PCK" ,title = "Average PCK Year-Round - Recent Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1)) +
facet_wrap(~parent.pop)
ggsave("../output/Climate/all_year_Avg_Monthly_PCK_RecentClim.png", width = 16, height = 10, units = "in")
flint_recent_all_year_mosavgs %>% ggplot(aes(x=month, y=ppt_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=ppt_mean-ppt_sem,ymax=ppt_mean+ppt_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation",x="Population", y="Avg Precip" ,title = "Average Precip Year-Round - Recent Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1))+
facet_wrap(~parent.pop)
ggsave("../output/Climate/all_year_Avg_Monthly_Precip_RecentClim.png", width = 12, height = 6, units = "in")
flint_recent_all_year_mosavgs %>% ggplot(aes(x=month, y=tmn_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=tmn_mean-tmn_sem,ymax=tmn_mean+tmn_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation",x="Population", y="Avg MinTemp" ,title = "Average MinTemp Year-Round - Recent Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1))+
facet_wrap(~parent.pop)
ggsave("../output/Climate/all_year_Avg_Monthly_MinTemp_RecentClim.png", width = 12, height = 6, units = "in")
flint_recent_all_year_mosavgs %>% ggplot(aes(x=month, y=tmx_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=tmx_mean-tmx_sem,ymax=tmx_mean+tmx_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation",x="Population", y="Avg MaxTemp" ,title = "Average MaxTemp Year-Round - Recent Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1))+
facet_wrap(~parent.pop)
ggsave("../output/Climate/all_year_Avg_Monthly_MaxTemp_RecentClim.png", width = 12, height = 6, units = "in")
flint_historical_all_year_mosavgs <- flint_historical_all_year %>% group_by(parent.pop, elevation.group, elev_m, month) %>% summarise_at(c("cwd", "pck", "ppt", "tmn", "tmx"), c(mean, sem), na.rm = TRUE)
names(flint_historical_all_year_mosavgs) <- gsub("fn2", "sem", colnames(flint_historical_all_year_mosavgs))
names(flint_historical_all_year_mosavgs) <-gsub("fn1", "mean", colnames(flint_historical_all_year_mosavgs))
flint_historical_all_year_mosavgs #30 year averages during growth season months
## # A tibble: 276 × 14
## # Groups: parent.pop, elevation.group, elev_m [23]
## parent.pop elevation.group elev_m month cwd_mean pck_mean ppt_mean tmn_mean
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 BH Low 511. 1 28.0 0.234 104. 1.46
## 2 BH Low 511. 2 40.4 0 92.2 2.76
## 3 BH Low 511. 3 51.2 0 101. 4.04
## 4 BH Low 511. 4 62.2 0 46.4 5.57
## 5 BH Low 511. 5 63.5 0 12.6 8.83
## 6 BH Low 511. 6 87.5 0 5.73 12.4
## 7 BH Low 511. 7 126. 0 2.09 15.6
## 8 BH Low 511. 8 149. 0 1.82 15.3
## 9 BH Low 511. 9 127. 0 10.1 12.6
## 10 BH Low 511. 10 87.3 0 31.9 8.48
## # ℹ 266 more rows
## # ℹ 6 more variables: tmx_mean <dbl>, cwd_sem <dbl>, pck_sem <dbl>,
## # ppt_sem <dbl>, tmn_sem <dbl>, tmx_sem <dbl>
flint_historical_all_year_mosavgs$elevation.group <- factor(flint_historical_all_year_mosavgs$elevation.group, levels=elev_order)
flint_historical_all_year_mosavgs %>% ggplot(aes(x=month, y=cwd_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=cwd_mean-cwd_sem,ymax=cwd_mean+cwd_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_x_continuous(breaks=c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0")+
labs(fill="Elevation",x="Population", y="Avg CWD" ,title = "Average CWD Year-Round - Historical Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1)) +
facet_wrap(~parent.pop)
ggsave("../output/Climate/all_year_Avg_Monthly_CWD_HistoricalClim.png", width = 16, height = 10, units = "in")
flint_historical_all_year_mosavgs %>% ggplot(aes(x=month, y=pck_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=pck_mean-pck_sem,ymax=pck_mean+pck_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_x_continuous(breaks=c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0")+
labs(fill="Elevation",x="Population", y="Avg PCK" ,title = "Average PCK Year-Round - Historical Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1)) +
facet_wrap(~parent.pop)
ggsave("../output/Climate/all_year_Avg_Monthly_PCK_HistoricalClim.png", width = 16, height = 10, units = "in")
flint_historical_all_year_mosavgs %>% ggplot(aes(x=month, y=ppt_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=ppt_mean-ppt_sem,ymax=ppt_mean+ppt_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation",x="Population", y="Avg Precip" ,title = "Average Precip Year-Round - Historical Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1))+
facet_wrap(~parent.pop)
ggsave("../output/Climate/all_year_Avg_Monthly_Precip_HistoricalClim.png", width = 12, height = 6, units = "in")
flint_historical_all_year_mosavgs %>% ggplot(aes(x=month, y=tmn_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=tmn_mean-tmn_sem,ymax=tmn_mean+tmn_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation",x="Population", y="Avg MinTemp" ,title = "Average MinTemp Year-Round - Historical Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1))+
facet_wrap(~parent.pop)
ggsave("../output/Climate/all_year_Avg_Monthly_MinTemp_HistoricalClim.png", width = 12, height = 6, units = "in")
flint_historical_all_year_mosavgs %>% ggplot(aes(x=month, y=tmx_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=tmx_mean-tmx_sem,ymax=tmx_mean+tmx_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation",x="Population", y="Avg MaxTemp" ,title = "Average MaxTemp Year-Round - Historical Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1))+
facet_wrap(~parent.pop)
ggsave("../output/Climate/all_year_Avg_Monthly_MaxTemp_HistoricalClim.png", width = 12, height = 6, units = "in")
flint_recent_all_year_avgs <- flint_recent_all_year %>% group_by(parent.pop, elevation.group, elev_m) %>% summarise_at(c("cwd", "pck", "ppt", "tmn", "tmx"), c(mean, sem), na.rm = TRUE)
names(flint_recent_all_year_avgs) <- gsub("fn2", "sem", colnames(flint_recent_all_year_avgs))
names(flint_recent_all_year_avgs) <-gsub("fn1", "mean", colnames(flint_recent_all_year_avgs))
flint_recent_all_year_avgs #30 year averages during growth season months
## # A tibble: 23 × 13
## # Groups: parent.pop, elevation.group [23]
## parent.pop elevation.group elev_m cwd_mean pck_mean ppt_mean tmn_mean
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 BH Low 511. 75.9 0 48.5 8.93
## 2 CC Low 313 59.9 0 84.3 10.0
## 3 CP2 High 2244. 62.9 218. 107. 1.18
## 4 CP3 High 2266. 46.2 236. 103. 0.529
## 5 DPR Mid 1019. 27.5 7.63 121. 7.89
## 6 FR Mid 787 75.5 14.1 84.9 5.70
## 7 IH Low 454. 49.3 0.167 89.2 8.68
## 8 LV1 High 2593. 49.8 441. 146. -1.36
## 9 LV3 High 2354. 40.9 436. 144. -1.37
## 10 LVTR1 High 2741. 52.1 454. 151. -1.57
## # ℹ 13 more rows
## # ℹ 6 more variables: tmx_mean <dbl>, cwd_sem <dbl>, pck_sem <dbl>,
## # ppt_sem <dbl>, tmn_sem <dbl>, tmx_sem <dbl>
flint_recent_all_year_avgs$elevation.group <- factor(flint_recent_all_year_avgs$elevation.group, levels=elev_order)
#write_csv(flint_recent_all_year_avgs, "../output/Climate/all_year__FlintAvgs_Recent.csv")
flint_recent_all_year_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, cwd_mean), y=cwd_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=cwd_mean-cwd_sem,ymax=cwd_mean+cwd_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0")+
labs(fill="Elevation",x="Population", y="Avg CWD" ,title = "Average CWD Year-Round - Recent Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_Avg_CWD_RecentClim.png", width = 12, height = 6, units = "in")
flint_recent_all_year_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, pck_mean), y=pck_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=pck_mean-pck_sem,ymax=pck_mean+pck_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0")+
labs(fill="Elevation",x="Population", y="Avg PCK" ,title = "Average PCK Year-Round - Recent Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_Avg_PCK_RecentClim.png", width = 12, height = 6, units = "in")
flint_recent_all_year_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, ppt_mean), y=ppt_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=ppt_mean-ppt_sem,ymax=ppt_mean+ppt_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation",x="Population", y="Avg Precip" ,title = "Average Precip Year-Round - Recent Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_Avg_Precip_RecentClim.png", width = 12, height = 6, units = "in")
flint_recent_all_year_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, tmn_mean), y=tmn_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=tmn_mean-tmn_sem,ymax=tmn_mean+tmn_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation",x="Population", y="Avg MinTemp" ,title = "Average MinTemp Year-Round - Recent Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_Avg_MinTemp_RecentClim.png", width = 12, height = 6, units = "in")
flint_recent_all_year_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, tmx_mean), y=tmx_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=tmx_mean-tmx_sem,ymax=tmx_mean+tmx_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation",x="Population", y="Avg MaxTemp" ,title = "Average MaxTemp Year-Round - Recent Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_Avg_MaxTemp_RecentClim.png", width = 12, height = 6, units = "in")
flint_historical_all_year_avgs <- flint_historical_all_year %>% group_by(parent.pop, elevation.group, elev_m) %>% summarise_at(c("cwd", "pck", "ppt", "tmn", "tmx"), c(mean, sem), na.rm = TRUE)
names(flint_historical_all_year_avgs) <- gsub("fn2", "sem", colnames(flint_historical_all_year_avgs))
names(flint_historical_all_year_avgs) <-gsub("fn1", "mean", colnames(flint_historical_all_year_avgs))
flint_historical_all_year_avgs #30 year averages during growth season months
## # A tibble: 23 × 13
## # Groups: parent.pop, elevation.group [23]
## parent.pop elevation.group elev_m cwd_mean pck_mean ppt_mean tmn_mean
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 BH Low 511. 74.5 0.0195 48.3 7.74
## 2 CC Low 313 59.7 0.0793 81.9 8.90
## 3 CP2 High 2244. 60.4 265. 110. -0.305
## 4 CP3 High 2266. 43.8 282. 106. -0.852
## 5 DPR Mid 1019. 26.5 20.5 120. 6.23
## 6 FR Mid 787 74.0 19.2 84.2 4.54
## 7 IH Low 454. 50.2 1.47 88.0 7.68
## 8 LV1 High 2593. 46.6 510. 149. -3.50
## 9 LV3 High 2354. 38.0 503. 147. -3.51
## 10 LVTR1 High 2741. 49.3 529. 155. -3.64
## # ℹ 13 more rows
## # ℹ 6 more variables: tmx_mean <dbl>, cwd_sem <dbl>, pck_sem <dbl>,
## # ppt_sem <dbl>, tmn_sem <dbl>, tmx_sem <dbl>
flint_historical_all_year_avgs$elevation.group <- factor(flint_historical_all_year_avgs$elevation.group, levels=elev_order)
#write_csv(flint_historical_all_year_avgs, "../output/Climate/all_year__FlintAvgs_Historic.csv")
flint_historical_all_year_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, cwd_mean), y=cwd_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=cwd_mean-cwd_sem,ymax=cwd_mean+cwd_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0")+
labs(fill="Elevation",x="Population", y="Avg CWD" ,title = "Average CWD Year-Round - Historical Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_Avg_CWD_HistoricalClim.png", width = 12, height = 6, units = "in")
flint_historical_all_year_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, pck_mean), y=pck_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=pck_mean-pck_sem,ymax=pck_mean+pck_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0")+
labs(fill="Elevation",x="Population", y="Avg PCK" ,title = "Average PCK Year-Round - Historical Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_Avg_PCK_HistoricalClim.png", width = 12, height = 6, units = "in")
flint_historical_all_year_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, ppt_mean), y=ppt_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=ppt_mean-ppt_sem,ymax=ppt_mean+ppt_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation",x="Population", y="Avg Precip" ,title = "Average Precip Year-Round - Historical Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_Avg_Precip_HistoricalClim.png", width = 12, height = 6, units = "in")
flint_historical_all_year_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, tmn_mean), y=tmn_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=tmn_mean-tmn_sem,ymax=tmn_mean+tmn_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation",x="Population", y="Avg MinTemp" ,title = "Average MinTemp Year-Round - Historical Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_Avg_MinTemp_HistoricalClim.png", width = 12, height = 6, units = "in")
flint_historical_all_year_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, tmx_mean), y=tmx_mean, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=tmx_mean-tmx_sem,ymax=tmx_mean+tmx_sem),width=.2, position =
position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation",x="Population", y="Avg MaxTemp" ,title = "Average MaxTemp Year-Round - Historical Climate") +
theme_classic() +
theme(text=element_text(size=20), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_Avg_MaxTemp_HistoricalClim.png", width = 12, height = 6, units = "in")
bioclim_recent_avgs <- bioclim_recent %>% group_by(parent.pop, elevation.group, elev_m) %>%
summarise_at(c("ann_tmean", "mean_diurnal_range", "temp_seasonality", "temp_ann_range", "tmean_wettest_quarter", "tmean_driest_quarter", "ann_ppt", "ppt_seasonality","ppt_warmest_quarter", "ppt_coldest_quarter"), c(mean, sem), na.rm = TRUE)
names(bioclim_recent_avgs) <- gsub("fn2", "sem", colnames(bioclim_recent_avgs))
names(bioclim_recent_avgs) <-gsub("fn1", "avg", colnames(bioclim_recent_avgs))
bioclim_recent_avgs
## # A tibble: 23 × 23
## # Groups: parent.pop, elevation.group [23]
## parent.pop elevation.group elev_m ann_tmean_avg mean_diurnal_range_avg
## <chr> <chr> <dbl> <dbl> <dbl>
## 1 BH Low 511. 16.2 14.6
## 2 CC Low 313 16.7 13.2
## 3 CP2 High 2244. 7.30 12.2
## 4 CP3 High 2266. 6.59 12.1
## 5 DPR Mid 1019. 14.1 12.4
## 6 FR Mid 787 12.9 14.4
## 7 IH Low 454. 15.4 13.5
## 8 LV1 High 2593. 4.93 12.6
## 9 LV3 High 2354. 4.94 12.6
## 10 LVTR1 High 2741. 4.78 12.7
## # ℹ 13 more rows
## # ℹ 18 more variables: temp_seasonality_avg <dbl>, temp_ann_range_avg <dbl>,
## # tmean_wettest_quarter_avg <dbl>, tmean_driest_quarter_avg <dbl>,
## # ann_ppt_avg <dbl>, ppt_seasonality_avg <dbl>,
## # ppt_warmest_quarter_avg <dbl>, ppt_coldest_quarter_avg <dbl>,
## # ann_tmean_sem <dbl>, mean_diurnal_range_sem <dbl>,
## # temp_seasonality_sem <dbl>, temp_ann_range_sem <dbl>, …
#write_csv(bioclim_recent_avgs, "../output/Climate/all_year_BioClimAvgs_Recent.csv")
bioclim_recent_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, ann_tmean_avg), y=ann_tmean_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=ann_tmean_avg-ann_tmean_sem,ymax=ann_tmean_avg+ann_tmean_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", y="Avg Annual Mean Temp", x="Population", title ="Recent Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_AnnMeanTmp_RecentClim.png", width = 12, height = 6, units = "in")
bioclim_recent_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, mean_diurnal_range_avg), y=mean_diurnal_range_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=mean_diurnal_range_avg-mean_diurnal_range_sem,ymax=mean_diurnal_range_avg+mean_diurnal_range_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", y="Avg Diurnal Range", x="Population", title ="Recent Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_DiurnalRange_RecentClim.png", width = 12, height = 6, units = "in")
bioclim_recent_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, temp_seasonality_avg), y=temp_seasonality_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=temp_seasonality_avg-temp_seasonality_sem,ymax=temp_seasonality_avg+temp_seasonality_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", x="Population", title ="Recent Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_TempSeasonality_RecentClim.png", width = 12, height = 6, units = "in")
bioclim_recent_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, temp_ann_range_avg), y=temp_ann_range_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=temp_ann_range_avg-temp_ann_range_sem,ymax=temp_ann_range_avg+temp_ann_range_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", x="Population", title ="Recent Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_AnnTmpRange_RecentClim.png", width = 12, height = 6, units = "in")
bioclim_recent_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, tmean_wettest_quarter_avg), y=tmean_wettest_quarter_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=tmean_wettest_quarter_avg-tmean_wettest_quarter_sem,ymax=tmean_wettest_quarter_avg+tmean_wettest_quarter_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", x="Population", title ="Recent Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_TmpMeanWet_RecentClim.png", width = 12, height = 6, units = "in")
bioclim_recent_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, tmean_driest_quarter_avg), y=tmean_driest_quarter_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=tmean_driest_quarter_avg-tmean_driest_quarter_sem,ymax=tmean_driest_quarter_avg+tmean_driest_quarter_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", x="Population", title ="Recent Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_TmpMeanDry_RecentClim.png", width = 12, height = 6, units = "in")
bioclim_recent_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, ann_ppt_avg), y=ann_ppt_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=ann_ppt_avg-ann_ppt_sem,ymax=ann_ppt_avg+ann_ppt_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", x="Population", title ="Recent Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_AnnPPT_RecentClim.png", width = 12, height = 6, units = "in")
bioclim_recent_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, ppt_seasonality_avg), y=ppt_seasonality_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=ppt_seasonality_avg-ppt_seasonality_sem,ymax=ppt_seasonality_avg+ppt_seasonality_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", x="Population", title ="Recent Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_PPTSeasonality_RecentClim.png", width = 12, height = 6, units = "in")
bioclim_recent_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, ppt_warmest_quarter_avg), y=ppt_warmest_quarter_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=ppt_warmest_quarter_avg-ppt_warmest_quarter_sem,ymax=ppt_warmest_quarter_avg+ppt_warmest_quarter_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", x="Population", title ="Recent Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_PPTWarm_RecentClim.png", width = 12, height = 6, units = "in")
bioclim_recent_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, ppt_coldest_quarter_avg), y=ppt_coldest_quarter_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=ppt_coldest_quarter_avg-ppt_coldest_quarter_sem,ymax=ppt_coldest_quarter_avg+ppt_coldest_quarter_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", x="Population", title ="Recent Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_PPTCold_RecentClim.png", width = 12, height = 6, units = "in")
names(bioclim_historical)
## [1] "parent.pop" "elevation.group" "elev_m"
## [4] "Lat" "Long" "year"
## [7] "ann_tmean" "mean_diurnal_range" "temp_seasonality"
## [10] "temp_ann_range" "tmean_wettest_quarter" "tmean_driest_quarter"
## [13] "ann_ppt" "ppt_seasonality" "ppt_warmest_quarter"
## [16] "ppt_coldest_quarter"
bioclim_historical_avgs <- bioclim_historical %>% group_by(parent.pop, elevation.group, elev_m) %>%
summarise_at(c("ann_tmean", "mean_diurnal_range", "temp_seasonality", "temp_ann_range", "tmean_wettest_quarter", "tmean_driest_quarter", "ann_ppt", "ppt_seasonality","ppt_warmest_quarter", "ppt_coldest_quarter"), c(mean, sem), na.rm = TRUE)
names(bioclim_historical_avgs) <- gsub("fn2", "sem", colnames(bioclim_historical_avgs))
names(bioclim_historical_avgs) <-gsub("fn1", "avg", colnames(bioclim_historical_avgs))
bioclim_historical_avgs
## # A tibble: 23 × 23
## # Groups: parent.pop, elevation.group [23]
## parent.pop elevation.group elev_m ann_tmean_avg mean_diurnal_range_avg
## <chr> <chr> <dbl> <dbl> <dbl>
## 1 BH Low 511. 15.3 15.2
## 2 CC Low 313 15.9 14.0
## 3 CP2 High 2244. 6.11 12.8
## 4 CP3 High 2266. 5.45 12.6
## 5 DPR Mid 1019. 13.0 13.5
## 6 FR Mid 787 12.3 15.6
## 7 IH Low 454. 14.8 14.2
## 8 LV1 High 2593. 3.40 13.8
## 9 LV3 High 2354. 3.40 13.8
## 10 LVTR1 High 2741. 3.25 13.8
## # ℹ 13 more rows
## # ℹ 18 more variables: temp_seasonality_avg <dbl>, temp_ann_range_avg <dbl>,
## # tmean_wettest_quarter_avg <dbl>, tmean_driest_quarter_avg <dbl>,
## # ann_ppt_avg <dbl>, ppt_seasonality_avg <dbl>,
## # ppt_warmest_quarter_avg <dbl>, ppt_coldest_quarter_avg <dbl>,
## # ann_tmean_sem <dbl>, mean_diurnal_range_sem <dbl>,
## # temp_seasonality_sem <dbl>, temp_ann_range_sem <dbl>, …
#write_csv(bioclim_historical_avgs, "../output/Climate/all_year_BioClimAvgs_Historical.csv")
bioclim_historical_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, ann_tmean_avg), y=ann_tmean_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=ann_tmean_avg-ann_tmean_sem,ymax=ann_tmean_avg+ann_tmean_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", y="Avg Annual Mean Temp", x="Population", title ="Historical Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_AnnMeanTmp_HistoricalClim.png", width = 12, height = 6, units = "in")
bioclim_historical_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, mean_diurnal_range_avg), y=mean_diurnal_range_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=mean_diurnal_range_avg-mean_diurnal_range_sem,ymax=mean_diurnal_range_avg+mean_diurnal_range_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", y="Avg Diurnal Range", x="Population", title ="Historical Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_DiurnalRange_HistoricalClim.png", width = 12, height = 6, units = "in")
bioclim_historical_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, temp_seasonality_avg), y=temp_seasonality_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=temp_seasonality_avg-temp_seasonality_sem,ymax=temp_seasonality_avg+temp_seasonality_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", x="Population", title ="Historical Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_TempSeasonality_HistoricalClim.png", width = 12, height = 6, units = "in")
bioclim_historical_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, temp_ann_range_avg), y=temp_ann_range_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=temp_ann_range_avg-temp_ann_range_sem,ymax=temp_ann_range_avg+temp_ann_range_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", x="Population", title ="Historical Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_AnnTmpRange_HistoricalClim.png", width = 12, height = 6, units = "in")
bioclim_historical_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, tmean_wettest_quarter_avg), y=tmean_wettest_quarter_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=tmean_wettest_quarter_avg-tmean_wettest_quarter_sem,ymax=tmean_wettest_quarter_avg+tmean_wettest_quarter_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", x="Population", title ="Historical Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_TmpMeanWet_HistoricalClim.png", width = 12, height = 6, units = "in")
bioclim_historical_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, tmean_driest_quarter_avg), y=tmean_driest_quarter_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=tmean_driest_quarter_avg-tmean_driest_quarter_sem,ymax=tmean_driest_quarter_avg+tmean_driest_quarter_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", x="Population", title ="Historical Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_TmpMeanDry_HistoricalClim.png", width = 12, height = 6, units = "in")
bioclim_historical_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, ann_ppt_avg), y=ann_ppt_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=ann_ppt_avg-ann_ppt_sem,ymax=ann_ppt_avg+ann_ppt_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", x="Population", title ="Historical Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_AnnPPT_HistoricalClim.png", width = 12, height = 6, units = "in")
bioclim_historical_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, ppt_seasonality_avg), y=ppt_seasonality_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=ppt_seasonality_avg-ppt_seasonality_sem,ymax=ppt_seasonality_avg+ppt_seasonality_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", x="Population", title ="Historical Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_PPTSeasonality_HistoricalClim.png", width = 12, height = 6, units = "in")
bioclim_historical_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, ppt_warmest_quarter_avg), y=ppt_warmest_quarter_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=ppt_warmest_quarter_avg-ppt_warmest_quarter_sem,ymax=ppt_warmest_quarter_avg+ppt_warmest_quarter_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", x="Population", title ="Historical Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_PPTWarm_HistoricalClim.png", width = 12, height = 6, units = "in")
bioclim_historical_avgs %>% ggplot(aes(x=fct_reorder(parent.pop, ppt_coldest_quarter_avg), y=ppt_coldest_quarter_avg, fill=elev_m)) +
geom_col(width = 0.7,position = position_dodge(0.75)) +
geom_errorbar(aes(ymin=ppt_coldest_quarter_avg-ppt_coldest_quarter_sem,ymax=ppt_coldest_quarter_avg+ppt_coldest_quarter_sem),width=.2, position = position_dodge(0.75)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_gradient(low = "#F5A540", high = "#0043F0") +
labs(fill="Elevation (m)", x="Population", title ="Historical Climate - Year-Round") +
theme_classic() +
theme(text=element_text(size=25), axis.text.x = element_text(angle = 45, hjust = 1))
ggsave("../output/Climate/all_year_PPTCold_HistoricalClim.png", width = 12, height = 6, units = "in")